package com.ailanyin.modules.system.controller;

import com.ailanyin.common.base.result.AjaxResult;
import com.ailanyin.modules.system.domain.SysExcelSetting;
import com.ailanyin.modules.system.domain.SysUser;
import com.ailanyin.modules.system.service.ISysExcelSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Excel导出设置Controller
 *
 * @author ailanyin
 * @date 2022-10-25
 */
@RestController
@RequestMapping("/system/excelSetting")
@Api(tags = "Excel导出设置管理")
public class SysExcelSettingController {

    @Autowired
    private ISysExcelSettingService sysExcelSettingService;

    /**
     * 查询Excel导出设置列表
     */
    @ApiOperation(value = "查询")
    @GetMapping("/getInfo")
    public AjaxResult getInfo(String className) {
        return AjaxResult.success(sysExcelSettingService.selectListByClassName(className));
    }

    /**
     * 新增Excel导出设置
     */
    @ApiOperation(value = "新增")
    @PostMapping
    public AjaxResult add() {
        sysExcelSettingService.insertSysExcelSetting(SysUser.class, "SysUser");
        return AjaxResult.success();
    }

    /**
     * 修改Excel导出设置
     */
    @ApiOperation(value = "修改")
    @PutMapping
    public AjaxResult edit(@RequestBody SysExcelSetting sysExcelSetting) {
        return AjaxResult.toAjax(sysExcelSettingService.updateSysExcelSetting(sysExcelSetting));
    }

}
